'''
整理json文件
'''

import os
import numpy as np

from tool import read_json, write_json, json_name_deal, response_deal


def main(save_path:str="ckpt", output_path:str="tmp/result_v3.json", json_name_format:list=["country-mode", "model", "exp-index"]):
    # 读取ckpt目录下的所有文件
    files = os.listdir(save_path)

    all_data = {}
    # 遍历所有文件
    for file in files:
        # 读取文件
        data = read_json(f"{save_path}/{file}")

        if "en" in file:
            new_filename = file.replace("en_", "").replace("country", "国家").replace("America", "美国")
            write_json(f"newckpt/{new_filename}", data)

if __name__ == "__main__":
    main(save_path="newckpt", output_path="tmp/result_newckpt.json",
         json_name_format=["country-mode", "country", "model", "exp-index"])
        